1.2.3 'react-scripts' 不是内部或外部命令

yarn start 出现 'react-scripts' 不是内部或外部命令

先把安装的 node-modules 目录删除,重新安装

yarn install
1

之后又出现

H:\react\antd-demo>yarn start
yarn run v1.13.0
$ react-scripts start

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

  "babel-eslint": "9.0.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-eslint was detected higher up in the tree:

  H:\react\antd-demo\node_modules\babel-eslint (version: 10.0.1)

Manually installing incompatible versions is known to cause hard-to-debug issues.

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exact order:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
  2. Delete node_modules in your project folder.
  3. Remove "babel-eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

说的是 babel-eslint 版本问题导致的,
package.json 中删除了依赖 babel-eslint 和 eslint ;
重新安装 yarn install
yarn start

参考